from AutomaticFrame.BasePage import BasePage
from AutomaticFrame.DoBingIni import ReadConfigIni


class BingPage(BasePage):
    # 页面元素
    # search_location = (By.ID, "sb_form_q")
    # search_btn = (By.CSS_SELECTOR, "#search_icon > svg")

    # ReadIniClass = ReadConfigIni("test.ini")
    # bing_search_input = ReadIniClass.getConfigValue("search_loc", "bing_search_input")
    # bing_search_btn = ReadIniClass.getConfigValue("search_loc", "bing_search_btn")
    # bing_search_input = ReadIniClass.get_element_loc("search_loc", "bing_search_input")
    # bing_search_btn = ReadIniClass.get_element_loc("search_loc", "bing_search_btn")
    # print("From Search-bing_search_input: ", bing_search_input)
    # print("From Search-bing_search_input: ", type(bing_search_input))

    def __init__(self, driver):
        ReadIniClass = ReadConfigIni("test.ini")
        self.bing_search_input = ReadIniClass.get_element_loc("search_loc", "bing_search_input")
        self.bing_search_btn = ReadIniClass.get_element_loc("search_loc", "bing_search_btn")
        self.driver = driver

    def search_content(self, content):
        # self.find_element(*self.search_location).input(content)
        self.input(self.bing_search_input, content, self.driver)

    def search_click(self):
        # self.find_element(*self.bing_search_btn).click()
        self.find_element(self.bing_search_btn, self.driver).click()















